package ControlLayer;

import java.util.ArrayList;

import DBLayer.DBSalesOrder;
import DBLayer.DBConnection;
import DBLayer.IFDBSalesOrder;
import ModelLayer.SalesOrder;


public class OrderCtr {
	
	public ArrayList<SalesOrder> findAllOrders()
    {
      IFDBSalesOrder dbP = new DBSalesOrder();
      ArrayList<SalesOrder> allp = dbP.getAll(false);
      return allp;
    }
	
	public void insertNew(String date, String deliveryDate, String deliveryStatus)
    {    
         SalesOrder oObj = new SalesOrder();
         oObj.setDate(date);
         oObj.setDeliveryDate(deliveryDate);
         oObj.setDeliveryStatus(deliveryStatus);
  
         try{
          DBConnection.startTransaction();
          DBSalesOrder dbEmp = new DBSalesOrder();
          dbEmp.insert(oObj);
          DBConnection.commitTransaction();
         }
         catch(Exception e)
         {
             DBConnection.rollbackTransaction();
         }
    }
	

}
